package net.mysoft.budgetsoft.system.domain;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

/**
 * 角色
 * @author kangrui
 *
 */
@Table(name="t_role")
@Entity
public class TRole extends BaseEntity {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -452829983677055048L;

	@ManyToMany
	@JoinTable(name="t_role_resource", joinColumns={@JoinColumn(name="role_id")}
		, inverseJoinColumns={@JoinColumn(name="resource_id")})
	private List<TResource> resources;		//角色对应的资源
	@ManyToMany()
	@JoinTable(name="t_user_role", joinColumns={@JoinColumn(name="role_id")}
	, inverseJoinColumns={@JoinColumn(name="user_id")})
	private List<TUser> users;				//拥有该角色的用户
	@ManyToMany
	@JoinTable(name="t_role_menu", joinColumns={@JoinColumn(name="role_id")}
	, inverseJoinColumns={@JoinColumn(name="menu_id")})
	private List<TMenu> menus;				//角色对应的菜单

	public List<TResource> getResources() {
		return resources;
	}
	public void setResources(List<TResource> resources) {
		this.resources = resources;
	}
	public List<TUser> getUsers() {
		return users;
	}
	public void setUsers(List<TUser> users) {
		this.users = users;
	}
	public List<TMenu> getMenus() {
		return menus;
	}
	public void setMenus(List<TMenu> menus) {
		this.menus = menus;
	}

}
